package com.ctgu.chatapp.view.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.ctgu.chatapp.databinding.ItemPhotowallBinding

class PhotoWallAdapter(val list: List<String>) :
    RecyclerView.Adapter<PhotoWallAdapter.ViewHolder>() {
    class ViewHolder(val binding: ItemPhotowallBinding) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val binding =
            ItemPhotowallBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        return ViewHolder(binding)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.binding.url = list[position]
    }

    override fun getItemCount() = list.size
}